import { reqGethostypeListContentShow } from '@/api/hospital/hospitalList';
import { hospitalShowType } from '@/api/hospital/model/hospitalListType';
import { Badge, Button, Card, Descriptions } from 'antd';
import React, { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';

function HospitalShow() {
    let { id } = useParams()
    // 存储List表单
    let [showList, setShowList] = useState<hospitalShowType>()
    // 设置并渲染页面
    async function RenderShowList() {
        let result = await reqGethostypeListContentShow(id as string)
        setShowList(result)
    }
    useEffect(() => {
        RenderShowList()
    }, [])
    return (
        <Card>
            <Descriptions title="基本信息" bordered>
                <Descriptions.Item label="医院名称" span={1}>{showList?.hospital.hosname}</Descriptions.Item>
                <Descriptions.Item label="医院logo" span={2}>{showList && <img alt='' width={100} src={`data:image/jpeg;base64,${showList.hospital.logoData}`}></img>}</Descriptions.Item>
                <Descriptions.Item label="医院编码" span={1}>{showList?.hospital.hoscode}</Descriptions.Item>
                <Descriptions.Item label="医院地址" span={2} >{showList?.hospital.address}</Descriptions.Item>
                <Descriptions.Item label="坐车路线" span={3}>
                    {showList?.hospital.route}
                </Descriptions.Item>
                <Descriptions.Item label="医院简介" span={3}>
                    {showList?.hospital.intro}
                </Descriptions.Item>
            </Descriptions>
            <Descriptions title="预约规则信息" bordered className='mt-20'>
                <Descriptions.Item label="预约周期" span={1}>{showList?.bookingRule.cycle}</Descriptions.Item>
                <Descriptions.Item label="放号时间" span={2}>Prepaid</Descriptions.Item>
                <Descriptions.Item label="停挂时间" span={1}>YES</Descriptions.Item>
                <Descriptions.Item label="退号时间" span={2} >2018-04-24 18:00:00</Descriptions.Item>
                <Descriptions.Item label="预约规则" span={3}>
                    2019-04-24 18:00:00
                </Descriptions.Item>
            </Descriptions>
            <Button className='mt-20'>返回</Button>
        </Card>
    );
}

export default HospitalShow;